package com.ftg.learn.chapter10.base02.util;

import com.ftg.learn.chapter10.base02.vo.StudentListVo;

import java.util.List;

/**
 * 页面信息
 *
 * @author 布衣
 */
public class PageInfo<E> {

    private Integer code;

    private Integer total;

    private String msg;

    private List<E> rows;

    public static <E> PageInfo<E> successForList(String msg,List<E> rows, Integer total){
        PageInfo<E> page = new PageInfo<>();
        page.setCode(0);
        page.setMsg(msg);
        page.setTotal(total);
        page.setRows(rows);
        return page;
    }

    @Override
    public String toString() {
        return "PageInfo{" +
                "code=" + code +
                ", total=" + total +
                ", msg='" + msg + '\'' +
                ", rows=" + rows +
                '}';
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<E> getRows() {
        return rows;
    }

    public void setRows(List<E> rows) {
        this.rows = rows;
    }
}
